var express = require('express');
var router = express.Router();
const user = require('./modules/user.js')
const goods = require('./modules/goods.js')
const store = require('./modules/store.js')
const order = require('./modules/order.js')
const { createMysqlTable } = require('./modules/sqlTable.js')
const {addOrder} = require('./modules/order.js')

// Mysql数据表创建
router.post('/create_mysql_table', createMysqlTable)

// 用户获取验证码
router.post('/get_code', user.getCode)

// 用户接口
router.post('/register', user.register)// 注册
router.post('/login', user.login)// 登录

// 商品接口
router.post('/add_goods', goods.addGoods)// 添加商品
router.get('/get_goods/:id?', goods.getGoods)// 获取商品
router.post('/set_goods/:id', goods.setGoods)// 修改商品

// 商品分类接口
router.post('/add_goods_category', goods.addGoodsCategory)// 添加商品分类
router.get('/get_goods_category/:id?', goods.getGoodsCategory)// 添加商品分类
router.post('/set_goods_category/:id', goods.setGoodsCategory)// 修改商品分类

// 商品品牌接口
router.post('/add_goods_brand', goods.addGoodsBrand)// 添加商品品牌
router.get('/get_goods_brand/:id?', goods.getGoodsBrand)// 获取商品品牌
router.post('/set_goods_brand/:id', goods.setGoodsBrand)// 修改商品品牌

// 店铺分类接口
router.post('/add_store_goods_category', goods.addStoreGoodsCategory)// 添加店铺分类
router.get('/get_store_goods_category/:id?', goods.getStoreGoodsCategory)// 获取店铺分类
router.post('/set_store_goods_category/:id', goods.setStoreGoodsCategory)// 修改店铺分类

// 店铺接口
router.post('/add_store', store.addStore)// 添加店铺分类
router.get('/get_store/:id?', store.getStore)// 获取店铺分类
router.post('/set_store/:id', store.setStore)// 修改店铺分类


// 用户订单
router.post('/add_order/:id?', order.addOrder)// 添加订单
router.get('/get_order/:id?', order.getOrders)// 获取订单
router.post('/set_order/:id', order.setOrder)// 修改订单

// 用户购物车



module.exports = router
